
-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 12/02/2012 12:42:00
-- Generated from EDMX file: C:\Users\Jay Paul\Documents\Visual Studio 2012\Projects\CS499ClassGrab\source\cs499\Database\cs499.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [cs499];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO

-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_BuildingRoom]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Places_Room] DROP CONSTRAINT [FK_BuildingRoom];
GO
IF OBJECT_ID(N'[dbo].[FK_CoursePlace_Course]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[CoursePlace] DROP CONSTRAINT [FK_CoursePlace_Course];
GO
IF OBJECT_ID(N'[dbo].[FK_CoursePlace_Place]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[CoursePlace] DROP CONSTRAINT [FK_CoursePlace_Place];
GO
IF OBJECT_ID(N'[dbo].[FK_DepartmentCourse]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Courses] DROP CONSTRAINT [FK_DepartmentCourse];
GO
IF OBJECT_ID(N'[dbo].[FK_DepartmentPlace]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Places] DROP CONSTRAINT [FK_DepartmentPlace];
GO
IF OBJECT_ID(N'[dbo].[FK_CourseCourse_depends]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[CourseCourse] DROP CONSTRAINT [FK_CourseCourse_depends];
GO
IF OBJECT_ID(N'[dbo].[FK_CourseCourse_prereqs]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[CourseCourse] DROP CONSTRAINT [FK_CourseCourse_prereqs];
GO
IF OBJECT_ID(N'[dbo].[FK_DepartmentFaculty]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[aspnet_user_Faculty] DROP CONSTRAINT [FK_DepartmentFaculty];
GO
IF OBJECT_ID(N'[dbo].[FK_DepartmentSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Schedules] DROP CONSTRAINT [FK_DepartmentSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_ScheduledCourseInstance]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[CourseInstances] DROP CONSTRAINT [FK_ScheduledCourseInstance];
GO
IF OBJECT_ID(N'[dbo].[FK_ConflictedCourseInstance]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[CourseInstances] DROP CONSTRAINT [FK_ConflictedCourseInstance];
GO
IF OBJECT_ID(N'[dbo].[FK_FacultyCourseInstance]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[CourseInstances] DROP CONSTRAINT [FK_FacultyCourseInstance];
GO
IF OBJECT_ID(N'[dbo].[FK_ScheduleCourseInstance]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[CourseInstances] DROP CONSTRAINT [FK_ScheduleCourseInstance];
GO
IF OBJECT_ID(N'[dbo].[FK_TimeSlotCourseInstance]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[CourseInstances] DROP CONSTRAINT [FK_TimeSlotCourseInstance];
GO
IF OBJECT_ID(N'[dbo].[FK_CourseCourseInstance]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[CourseInstances] DROP CONSTRAINT [FK_CourseCourseInstance];
GO
IF OBJECT_ID(N'[dbo].[FK_RoomCourseInstance]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[CourseInstances] DROP CONSTRAINT [FK_RoomCourseInstance];
GO
IF OBJECT_ID(N'[dbo].[FK_FacultyCourseInstance1]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[CourseInstances] DROP CONSTRAINT [FK_FacultyCourseInstance1];
GO
IF OBJECT_ID(N'[dbo].[FK_Building_inherits_Place]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Places_Building] DROP CONSTRAINT [FK_Building_inherits_Place];
GO
IF OBJECT_ID(N'[dbo].[FK_Room_inherits_Place]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Places_Room] DROP CONSTRAINT [FK_Room_inherits_Place];
GO
IF OBJECT_ID(N'[dbo].[FK_Faculty_inherits_aspnet_user]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[aspnet_user_Faculty] DROP CONSTRAINT [FK_Faculty_inherits_aspnet_user];
GO

-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[Courses]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Courses];
GO
IF OBJECT_ID(N'[dbo].[Departments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Departments];
GO
IF OBJECT_ID(N'[dbo].[TimeSlots]', 'U') IS NOT NULL
    DROP TABLE [dbo].[TimeSlots];
GO
IF OBJECT_ID(N'[dbo].[Places]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Places];
GO
IF OBJECT_ID(N'[dbo].[aspnet_user]', 'U') IS NOT NULL
    DROP TABLE [dbo].[aspnet_user];
GO
IF OBJECT_ID(N'[dbo].[CourseInstances]', 'U') IS NOT NULL
    DROP TABLE [dbo].[CourseInstances];
GO
IF OBJECT_ID(N'[dbo].[Schedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Schedules];
GO
IF OBJECT_ID(N'[dbo].[Places_Building]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Places_Building];
GO
IF OBJECT_ID(N'[dbo].[Places_Room]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Places_Room];
GO
IF OBJECT_ID(N'[dbo].[aspnet_user_Faculty]', 'U') IS NOT NULL
    DROP TABLE [dbo].[aspnet_user_Faculty];
GO
IF OBJECT_ID(N'[dbo].[CoursePlace]', 'U') IS NOT NULL
    DROP TABLE [dbo].[CoursePlace];
GO
IF OBJECT_ID(N'[dbo].[CourseCourse]', 'U') IS NOT NULL
    DROP TABLE [dbo].[CourseCourse];
GO

-- --------------------------------------------------
-- Creating all tables
-- --------------------------------------------------

-- Creating table 'Courses'
CREATE TABLE [dbo].[Courses] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Number] int  NOT NULL,
    [NumberOfSections] int  NOT NULL,
    [CourseTitle] nvarchar(max)  NOT NULL,
    [MaximumEnrollment] int  NOT NULL,
    [DepartmentId] int  NOT NULL,
    [PlaceRequirementsstring] nvarchar(max)  NULL
);
GO

-- Creating table 'Departments'
CREATE TABLE [dbo].[Departments] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Name] nvarchar(max)  NOT NULL,
    [Code] nvarchar(max)  NOT NULL
);
GO

-- Creating table 'TimeSlots'
CREATE TABLE [dbo].[TimeSlots] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [StartTime] time  NOT NULL,
    [Length] int  NOT NULL,
    [Days] int  NOT NULL
);
GO

-- Creating table 'Places'
CREATE TABLE [dbo].[Places] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [PlaceName] nvarchar(max)  NOT NULL,
    [DepartmentId] int  NOT NULL
);
GO

-- Creating table 'aspnet_user'
CREATE TABLE [dbo].[aspnet_user] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [aspnet_userID] uniqueidentifier  NOT NULL
);
GO

-- Creating table 'CourseInstances'
CREATE TABLE [dbo].[CourseInstances] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [ScheduleIdforConflicted] int  NULL,
    [SectionNumber] int  NOT NULL,
    [ScheduleIdforScheduled] int  NULL,
    [PreferredBy_Id] int  NULL,
    [Schedule_Id] int  NULL,
    [TimeSlot_Id] int  NULL,
    [Course_Id] int  NULL,
    [Room_Id] int  NULL,
    [TaughtBy_Id] int  NULL
);
GO

-- Creating table 'Schedules'
CREATE TABLE [dbo].[Schedules] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Department_Id] int  NOT NULL
);
GO

-- Creating table 'Places_Building'
CREATE TABLE [dbo].[Places_Building] (
    [Code] nvarchar(max)  NOT NULL,
    [Name] nvarchar(max)  NOT NULL,
    [Id] int  NOT NULL
);
GO

-- Creating table 'Places_Room'
CREATE TABLE [dbo].[Places_Room] (
    [Capacity] int  NOT NULL,
    [Number] nvarchar(max)  NOT NULL,
    [BuildingID] int  NOT NULL,
    [Id] int  NOT NULL
);
GO

-- Creating table 'aspnet_user_Faculty'
CREATE TABLE [dbo].[aspnet_user_Faculty] (
    [DepartmentID] int  NOT NULL,
    [Id] int  NOT NULL
);
GO

-- Creating table 'CoursePlace'
CREATE TABLE [dbo].[CoursePlace] (
    [DependentCourses_Id] int  NOT NULL,
    [PlaceRequirements_Id] int  NOT NULL
);
GO

-- Creating table 'CourseCourse'
CREATE TABLE [dbo].[CourseCourse] (
    [PrereqCourses_Id] int  NOT NULL,
    [DependentCourses_Id] int  NOT NULL
);
GO

-- --------------------------------------------------
-- Creating all PRIMARY KEY constraints
-- --------------------------------------------------

-- Creating primary key on [Id] in table 'Courses'
ALTER TABLE [dbo].[Courses]
ADD CONSTRAINT [PK_Courses]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'Departments'
ALTER TABLE [dbo].[Departments]
ADD CONSTRAINT [PK_Departments]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'TimeSlots'
ALTER TABLE [dbo].[TimeSlots]
ADD CONSTRAINT [PK_TimeSlots]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'Places'
ALTER TABLE [dbo].[Places]
ADD CONSTRAINT [PK_Places]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'aspnet_user'
ALTER TABLE [dbo].[aspnet_user]
ADD CONSTRAINT [PK_aspnet_user]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'CourseInstances'
ALTER TABLE [dbo].[CourseInstances]
ADD CONSTRAINT [PK_CourseInstances]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'Schedules'
ALTER TABLE [dbo].[Schedules]
ADD CONSTRAINT [PK_Schedules]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'Places_Building'
ALTER TABLE [dbo].[Places_Building]
ADD CONSTRAINT [PK_Places_Building]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'Places_Room'
ALTER TABLE [dbo].[Places_Room]
ADD CONSTRAINT [PK_Places_Room]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'aspnet_user_Faculty'
ALTER TABLE [dbo].[aspnet_user_Faculty]
ADD CONSTRAINT [PK_aspnet_user_Faculty]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [DependentCourses_Id], [PlaceRequirements_Id] in table 'CoursePlace'
ALTER TABLE [dbo].[CoursePlace]
ADD CONSTRAINT [PK_CoursePlace]
    PRIMARY KEY NONCLUSTERED ([DependentCourses_Id], [PlaceRequirements_Id] ASC);
GO

-- Creating primary key on [PrereqCourses_Id], [DependentCourses_Id] in table 'CourseCourse'
ALTER TABLE [dbo].[CourseCourse]
ADD CONSTRAINT [PK_CourseCourse]
    PRIMARY KEY NONCLUSTERED ([PrereqCourses_Id], [DependentCourses_Id] ASC);
GO

-- --------------------------------------------------
-- Creating all FOREIGN KEY constraints
-- --------------------------------------------------

-- Creating foreign key on [BuildingID] in table 'Places_Room'
ALTER TABLE [dbo].[Places_Room]
ADD CONSTRAINT [FK_BuildingRoom]
    FOREIGN KEY ([BuildingID])
    REFERENCES [dbo].[Places_Building]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_BuildingRoom'
CREATE INDEX [IX_FK_BuildingRoom]
ON [dbo].[Places_Room]
    ([BuildingID]);
GO

-- Creating foreign key on [DependentCourses_Id] in table 'CoursePlace'
ALTER TABLE [dbo].[CoursePlace]
ADD CONSTRAINT [FK_CoursePlace_Course]
    FOREIGN KEY ([DependentCourses_Id])
    REFERENCES [dbo].[Courses]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [PlaceRequirements_Id] in table 'CoursePlace'
ALTER TABLE [dbo].[CoursePlace]
ADD CONSTRAINT [FK_CoursePlace_Place]
    FOREIGN KEY ([PlaceRequirements_Id])
    REFERENCES [dbo].[Places]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_CoursePlace_Place'
CREATE INDEX [IX_FK_CoursePlace_Place]
ON [dbo].[CoursePlace]
    ([PlaceRequirements_Id]);
GO

-- Creating foreign key on [DepartmentId] in table 'Courses'
ALTER TABLE [dbo].[Courses]
ADD CONSTRAINT [FK_DepartmentCourse]
    FOREIGN KEY ([DepartmentId])
    REFERENCES [dbo].[Departments]
        ([Id])
    ON DELETE CASCADE ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_DepartmentCourse'
CREATE INDEX [IX_FK_DepartmentCourse]
ON [dbo].[Courses]
    ([DepartmentId]);
GO

-- Creating foreign key on [DepartmentId] in table 'Places'
ALTER TABLE [dbo].[Places]
ADD CONSTRAINT [FK_DepartmentPlace]
    FOREIGN KEY ([DepartmentId])
    REFERENCES [dbo].[Departments]
        ([Id])
    ON DELETE CASCADE ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_DepartmentPlace'
CREATE INDEX [IX_FK_DepartmentPlace]
ON [dbo].[Places]
    ([DepartmentId]);
GO

-- Creating foreign key on [PrereqCourses_Id] in table 'CourseCourse'
ALTER TABLE [dbo].[CourseCourse]
ADD CONSTRAINT [FK_CourseCourse_depends]
    FOREIGN KEY ([PrereqCourses_Id])
    REFERENCES [dbo].[Courses]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [DependentCourses_Id] in table 'CourseCourse'
ALTER TABLE [dbo].[CourseCourse]
ADD CONSTRAINT [FK_CourseCourse_prereqs]
    FOREIGN KEY ([DependentCourses_Id])
    REFERENCES [dbo].[Courses]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_CourseCourse_prereqs'
CREATE INDEX [IX_FK_CourseCourse_prereqs]
ON [dbo].[CourseCourse]
    ([DependentCourses_Id]);
GO

-- Creating foreign key on [DepartmentID] in table 'aspnet_user_Faculty'
ALTER TABLE [dbo].[aspnet_user_Faculty]
ADD CONSTRAINT [FK_DepartmentFaculty]
    FOREIGN KEY ([DepartmentID])
    REFERENCES [dbo].[Departments]
        ([Id])
    ON DELETE CASCADE ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_DepartmentFaculty'
CREATE INDEX [IX_FK_DepartmentFaculty]
ON [dbo].[aspnet_user_Faculty]
    ([DepartmentID]);
GO

-- Creating foreign key on [Department_Id] in table 'Schedules'
ALTER TABLE [dbo].[Schedules]
ADD CONSTRAINT [FK_DepartmentSchedule]
    FOREIGN KEY ([Department_Id])
    REFERENCES [dbo].[Departments]
        ([Id])
    ON DELETE CASCADE ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_DepartmentSchedule'
CREATE INDEX [IX_FK_DepartmentSchedule]
ON [dbo].[Schedules]
    ([Department_Id]);
GO

-- Creating foreign key on [ScheduleIdforScheduled] in table 'CourseInstances'
ALTER TABLE [dbo].[CourseInstances]
ADD CONSTRAINT [FK_ScheduledCourseInstance]
    FOREIGN KEY ([ScheduleIdforScheduled])
    REFERENCES [dbo].[Schedules]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ScheduledCourseInstance'
CREATE INDEX [IX_FK_ScheduledCourseInstance]
ON [dbo].[CourseInstances]
    ([ScheduleIdforScheduled]);
GO

-- Creating foreign key on [ScheduleIdforConflicted] in table 'CourseInstances'
ALTER TABLE [dbo].[CourseInstances]
ADD CONSTRAINT [FK_ConflictedCourseInstance]
    FOREIGN KEY ([ScheduleIdforConflicted])
    REFERENCES [dbo].[Schedules]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ConflictedCourseInstance'
CREATE INDEX [IX_FK_ConflictedCourseInstance]
ON [dbo].[CourseInstances]
    ([ScheduleIdforConflicted]);
GO

-- Creating foreign key on [PreferredBy_Id] in table 'CourseInstances'
ALTER TABLE [dbo].[CourseInstances]
ADD CONSTRAINT [FK_FacultyCourseInstance]
    FOREIGN KEY ([PreferredBy_Id])
    REFERENCES [dbo].[aspnet_user_Faculty]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_FacultyCourseInstance'
CREATE INDEX [IX_FK_FacultyCourseInstance]
ON [dbo].[CourseInstances]
    ([PreferredBy_Id]);
GO

-- Creating foreign key on [Schedule_Id] in table 'CourseInstances'
ALTER TABLE [dbo].[CourseInstances]
ADD CONSTRAINT [FK_ScheduleCourseInstance]
    FOREIGN KEY ([Schedule_Id])
    REFERENCES [dbo].[Schedules]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ScheduleCourseInstance'
CREATE INDEX [IX_FK_ScheduleCourseInstance]
ON [dbo].[CourseInstances]
    ([Schedule_Id]);
GO

-- Creating foreign key on [TimeSlot_Id] in table 'CourseInstances'
ALTER TABLE [dbo].[CourseInstances]
ADD CONSTRAINT [FK_TimeSlotCourseInstance]
    FOREIGN KEY ([TimeSlot_Id])
    REFERENCES [dbo].[TimeSlots]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_TimeSlotCourseInstance'
CREATE INDEX [IX_FK_TimeSlotCourseInstance]
ON [dbo].[CourseInstances]
    ([TimeSlot_Id]);
GO

-- Creating foreign key on [Course_Id] in table 'CourseInstances'
ALTER TABLE [dbo].[CourseInstances]
ADD CONSTRAINT [FK_CourseCourseInstance]
    FOREIGN KEY ([Course_Id])
    REFERENCES [dbo].[Courses]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_CourseCourseInstance'
CREATE INDEX [IX_FK_CourseCourseInstance]
ON [dbo].[CourseInstances]
    ([Course_Id]);
GO

-- Creating foreign key on [Room_Id] in table 'CourseInstances'
ALTER TABLE [dbo].[CourseInstances]
ADD CONSTRAINT [FK_RoomCourseInstance]
    FOREIGN KEY ([Room_Id])
    REFERENCES [dbo].[Places_Room]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_RoomCourseInstance'
CREATE INDEX [IX_FK_RoomCourseInstance]
ON [dbo].[CourseInstances]
    ([Room_Id]);
GO

-- Creating foreign key on [TaughtBy_Id] in table 'CourseInstances'
ALTER TABLE [dbo].[CourseInstances]
ADD CONSTRAINT [FK_FacultyCourseInstance1]
    FOREIGN KEY ([TaughtBy_Id])
    REFERENCES [dbo].[aspnet_user_Faculty]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_FacultyCourseInstance1'
CREATE INDEX [IX_FK_FacultyCourseInstance1]
ON [dbo].[CourseInstances]
    ([TaughtBy_Id]);
GO

-- Creating foreign key on [Id] in table 'Places_Building'
ALTER TABLE [dbo].[Places_Building]
ADD CONSTRAINT [FK_Building_inherits_Place]
    FOREIGN KEY ([Id])
    REFERENCES [dbo].[Places]
        ([Id])
    ON DELETE CASCADE ON UPDATE NO ACTION;
GO

-- Creating foreign key on [Id] in table 'Places_Room'
ALTER TABLE [dbo].[Places_Room]
ADD CONSTRAINT [FK_Room_inherits_Place]
    FOREIGN KEY ([Id])
    REFERENCES [dbo].[Places]
        ([Id])
    ON DELETE CASCADE ON UPDATE NO ACTION;
GO

-- Creating foreign key on [Id] in table 'aspnet_user_Faculty'
ALTER TABLE [dbo].[aspnet_user_Faculty]
ADD CONSTRAINT [FK_Faculty_inherits_aspnet_user]
    FOREIGN KEY ([Id])
    REFERENCES [dbo].[aspnet_user]
        ([Id])
    ON DELETE CASCADE ON UPDATE NO ACTION;
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------